package mr.ali.webvideo.jsSdk;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/wechat")
public class WechatJsapiController {

    @Autowired
    private WechatService wechatService;

    @GetMapping("/signature")
    public Result getSignature(@RequestParam String url) {
        try {
            return Result.success(wechatService.createJsapiSignature(url));
        } catch (Exception e) {
            return Result.error("获取签名失败: " + e.getMessage());
        }
    }
}